<extend name="common" />
<block name="main">
<div class="signin-main">
    <div class="signin-hd txt-grey">用户登录</div>
    <div class="signin-bd clear">
        <form class="form-horizontal" role="form" data-validate="false" action="__URL__/login" method="post">
          <div class="form-group">
            <div class="col-sm-12">
              <input type="text" data-bv-notempty-message="请输入用户名" class="form-control" name="username" required placeholder="用户名">
            </div>
          </div>
          <div class="form-group">
            <div class="col-sm-12">
              <input type="password" class="form-control" data-bv-notempty-message="请输入密码" name="password" required placeholder="请输入密码">
            </div>
          </div>
          <div class="form-group">
            <div class="col-sm-12">
              <a href="register">还没有账号？点我注册</a>
            </div>
          </div>
          <div class="form-group">
            <div class="col-sm-offset-4 col-sm-8">
              <button type="submit" class="btn btn-primary col-sm-5 btn-submit">登录</button>
            </div>
          </div>
        </form>
    </div>
</div>
<script>
$(function(){
  $('form').bootstrapValidator({
    message: 'This value is not valid',
            feedbackIcons: {/*输入框不同状态，显示图片的样式*/
                valid: 'glyphicon glyphicon-ok',
                invalid: 'glyphicon glyphicon-remove',
                validating: 'glyphicon glyphicon-refresh'
            },
            fields: {/*验证*/
                username: {/*键名username和input name值对应*/
                    message: '无效的用户名',
                    validators: {
                        notEmpty: {/*非空提示*/
                            message: '用户名不能为空'
                        },
                        stringLength: {/*长度提示*/
                            min: 4,
                            max: 30,
                            message: '用户名长度必须在4到30之间'
                        }/*最后一个没有逗号*/
                    }
                },
                password: {
                    message:'密码无效',
                    validators: {
                        notEmpty: {
                            message: '密码不能为空'
                        },
                        stringLength: {
                            min: 6,
                            max: 30,
                            message: '用户名长度必须在6到30之间'
                        }
                    }
                },
            }
  });
})
</script>
</block>